<?php
class project_Model extends MY_Model{
	public function __construct(){
		parent::__construct();
		$this->setTable('project');
	}
	function getProjectByID($id=null){
		try{
			if($id==null){
				return $this->getAll();
			}else{
				$this->db->where("project_id",$id);
				$data = $this->db->get($this->getTable())->result_object();
				if(is_object($data)) return $data;
				else if(is_array($data) && count($data) > 0) return $data[0];
				else return null;
			}
		}catch(Exception $ex){
			throw $ex;
		}
	
	}
	function updateProjectByID($id,$data = array()){
		try {
			$this->db->where("project_id",$id);
			return $this->db->update($this->getTable(),$data);
		} catch (Exception $e) {
			throw $e;
		}
	}
}